package com.acme.bankapp.service.bank;


public class EmailSender implements Runnable {
    private Queue _queue;
    public Thread thread;

    EmailSender(Queue queue) {
        this._queue = queue;
        thread = new Thread(this, "Email.Sender");
        thread.start();
    }

    @Override
    public void run() {
        System.out.printf("\n---in email.sender---\n");
        do {
            while (!this._queue.isEmpty) {
                this._queue.remove();
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
            }
        } while (!this._queue.isClosed);
        System.out.printf("\n---out email.sender---\n");
    }
}
